package com.cby.library.common.base

import android.widget.LinearLayout
import androidx.viewpager.widget.ViewPager
import com.cby.library.common.R
import com.cby.library.common.adapter.CommonViewPagerAdapter
import com.google.android.material.tabs.TabLayout


/**
 * @description: BaseStatetabActivity
 *
 * @author ChenBaoyang
 * @date 4/29/21 10:22
 */
abstract class BaseStateTabActivity<VM : BaseViewModel> : BaseStateActivity<VM>(){


    private lateinit var container: LinearLayout
    private lateinit var tabLayout: TabLayout
    private lateinit var viewPager: ViewPager
    protected lateinit var pagerAdapter: CommonViewPagerAdapter


    override fun getLayoutId() = R.layout.common_view_pager

    override fun getPageTarget() = container

    override fun initView() {
        container = findViewById(R.id.container)
        tabLayout = findViewById(R.id.tab_layout)
        viewPager = findViewById(R.id.view_pager)
        pagerAdapter = CommonViewPagerAdapter(supportFragmentManager)

        viewPager.adapter = pagerAdapter
        tabLayout.setupWithViewPager(viewPager)
    }


    override fun reload() {

    }
}